from django.dispatch import receiver
from django.db.models.signals import post_save
from users.models import UserProfile


@receiver(post_save, sender=UserProfile)
def create_auth_token(sender, instance, created, **kwargs):
    if created:
        password = instance.password
        instance.set_password(password)
        instance.save()

